package cn.com.code.hwjs;

import java.util.Scanner;

/**
 * 坐标移动
 * https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29?tpId=37&tqId=21240&rp=1&ru=/exam/oj&qru=/exam/oj&sourceUrl=%2Fexam%2Foj%3Fdifficulty%3D3%26page%3D1%26pageSize%3D50%26search%3D%26tab%3D%25E5%2590%258D%25E4%25BC%2581%25E7%25AC%2594%25E8%25AF%2595%25E7%259C%259F%25E9%25A2%2598%26topicId%3D37&difficulty=3&judgeStatus=undefined&tags=&title=
 *
 * @author zhengpei
 * @date 2022/4/20
 */
public class Hwjs17 {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String next = sc.next();
    String[] arr = next.split(";");
    int x = 0;
    int y = 0;
    for (int i = 0; i < arr.length; i++) {
      if (!arr[i].matches("^[A-Z][0-9]{1,2}")) {
        continue;
      }
      char[] chars = arr[i].toCharArray();
      int num = Integer.parseInt(arr[i].replaceAll("^[A-Z]", ""));
      switch (chars[0]) {
        case 'A':
          x = x - num;
          break;
        case 'D':
          x = x + num;
          break;
        case 'W':
          y = y + num;
          break;
        case 'S':
          y = y - num;
          break;
      }
    }
    System.out.println(x + "," + y);
  }

}
